# encoding: utf-8
from flask_marshmallow import base_fields

from flask_restplus_patched import ModelSchema
from app.modules.common.schemas import BaseSchema
from .models import LogInfo


class LogBaseSchema(ModelSchema):
    class Meta:
        model = LogInfo
        fields = (
            'id',
            'log',
            'create_time',
            'account',
            'br_count',
            'color',
            'zone_code',
            'env_name',
            'entrance_types',
            'group',
            'show_error',
        )


class LogListSchema(BaseSchema):
    data = base_fields.Nested(
        LogBaseSchema,
        many = True
    )

    class Meta:
        fields = BaseSchema.Meta.fields + (
            'data',
        )
